﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SnmpForm.ApBatchConfig
{
    class BatchSnmpTrustTask:BatchTask
    {
        string m_strPasswd = null;
        public BatchSnmpTrustTask(FrmApBatchConfig objForm,
            List<BusinessWrapper.Ap> aps,
            string passwd)
            : base(objForm, aps)
        {
            m_strPasswd = passwd;
        }

        public override void ApRequestAction(BusinessWrapper.Ap ap)
        {
            if (ap.SetSecurePasswd(m_strPasswd))
            {
                DbWrapper.DbDataTypes.Ap info = ap.GetInfo();
                info.snmp_password = m_strPasswd;
                BusinessWrapper.User.Instance.ModifyAp(info);
            }
            else
            {
                throw new Exception("同步错误");
            }
        }
    }
}
